package main

import (
	"common/handler"
	"common/middleware/jwt"
	_ "common/models" //这个要导入 里面的init()才会执行  下划线是不使用也不报错
	"log"

	"github.com/gin-gonic/gin"
)

func main() {
	engine := gin.New()

	engine.POST("/account/add", handler.AddAccount)
	engine.POST("/account/login", handler.LoginAccount)
	engine.POST("/message/list", handler.ListLiuyan)
	engine.POST("/message/detail", handler.DetailLiuyan)

	//跳转jwt中间件验证登录凭证
	engine.Use(jwt.JWT())
	{
		engine.POST("/message/add", handler.AddLiuyan)
		engine.POST("/message/del", handler.DelLiuyan)
		engine.POST("/account/del", handler.DelAccount)
	}

	if err := engine.Run(":8080"); err != nil {
		log.Fatal(err)
	}
}
